<html>
<head>
	<script type="text/javascript" src="<?php echo base_url();?>/js/timepicker/jquery-ui-sliderAccess.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>/js/timepicker/jquery-ui-timepicker-addon.js"></script>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>/js/timepicker/jquery-ui-timepicker-addon.css">
</head>

<?php if ($success!=''){?>
<h4 class="alert_success"><?php echo $success;?></h4>
<?php }?>
<?php if ($error!=''){?>
<h4 class="alert_error"><?php echo $error;?></h4>
<?php }?>
<form action="<?php echo site_url();?>/profile" method="POST" id="profile-form" enctype="multipart/form-data">
<article class="module width_half" style="margin-bottom: 20px;">
	<header>
		<h3 style="width: 50%;">Thông tin cá nhân</h3>
	</header>
	<div class="module_content">
		<fieldset>
			<label>Tên truy cập</label>
			<input type="text" disabled name="user" value="<?php echo $user->user;?>" style="width:40%;">
		</fieldset>
		<?php if($type == 1) {?>
		<fieldset>
			<label>Mã số sinh viên</label>
			<input type="text" name="studentid" value="<?php echo $user->studentid;?>" style="width:40%;">
		</fieldset>
		<?php } if($type == 0) {?>
		<fieldset>
			<label>Mã số giảng viên</label>
			<input type="text" name="teacherid" value="<?php echo $user->teacherid;?>" style="width:40%;">
		</fieldset>
		<?php } ?>
		<fieldset>
			<label>Tên đầy đủ</label>
			<input type="text" name="fullname" value="<?php echo $user->fullname;?>" style="width:40%;">
		</fieldset>
		<fieldset>
			<label>Ngày sinh</label>
			<input id="dob" type="text" name="dob" placeholder="dd/mm/YYYY" value="<?php echo date('d-m-Y',$user->dob);?>" style="width:40%;" id="dob">
		</fieldset>
		<fieldset>
			<label>Giới tính</label>
			<select name="gender" id="gender" style="width:42%;height:24px;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;background-color:#fff;">
				<option value="null">Không xác định</option>
				<option value="1"<?php echo ($user->gender==1)?' selected':'';?>>Nam</option>
				<option value="2"<?php echo ($user->gender==2)?' selected':'';?>>Nữ</option>
			</select>
		</fieldset>
		<?php if($type == 1) {?>
		<fieldset>
			<label>Lớp học</label>
			<?php
			if (!$user->class){
				$user->class = 'K'.substr($user->user, strpos($user->user,'_')+1,strlen($user->user));
			}
			?>
			<input type="text" name="class" value="<?php echo $user->class;?>" style="width:40%;">
		</fieldset>
		<?php } if($type == 0) {?>
		<fieldset>
			<label>Bộ môn</label>
			<input type="text" name="subject" value="<?php echo $user->subject;?>" style="width:40%;">
		</fieldset>
		<?php } ?>
		<fieldset>
			<label>Thành phố</label>
			<select name="hometown" id="hometown" style="width:42%;height:24px;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;background-color:#fff;">
				<option value="0">Ở ngoài Việt Nam</option>
				<option value="59">TP. Hồ Chí Minh</option>
				<option value="24">Hà Nội</option>
				<option value="27">Hải Dương</option>
				<option value="28">Hải Phòng</option>
				<option value="29">Hậu Giang</option>
				<option value="30">Hòa Bình</option>
				<option value="31">Hưng Yên</option>
				<option value="32">Khánh Hòa</option>
				<option value="33">Kiên Giang</option>
				<option value="34">Kon Tum</option>
				<option value="35">Lai Châu</option>
				<option value="36">Lạng Sơn</option>
				<option value="37">Lào Cai</option>
				<option value="38">Lâm Đồng</option>
				<option value="39">Long An</option>
				<option value="40">Nam Định</option>
				<option value="41">Nghệ An</option>
				<option value="42">Ninh Bình</option>
				<option value="43">Ninh Thuận</option>
				<option value="44">Phú Thọ</option>
				<option value="45">Phú Yên</option>
				<option value="46">Quảng Bình</option>
				<option value="47">Quảng Nam</option>
				<option value="48">Quảng Ngãi</option>
				<option value="49">Quảng Ninh</option>
				<option value="50">Quảng Trị</option>
				<option value="51">Sóc Trăng</option>
				<option value="52">Sơn La</option>
				<option value="53">Tây Ninh</option>
				<option value="54">Thái Bình</option>
				<option value="55">Thái Nguyên</option>
				<option value="56">Thanh Hóa</option>
				<option value="57">Thừa Thiên Huế</option>
				<option value="58">Tiền Giang</option>
				<option value="1">An Giang</option>
				<option value="2">Bà Rịa Vũng Tàu</option>
				<option value="3">Bình Dương</option>
				<option value="4">Bình Phước</option>
				<option value="5">Bình Thuận</option>
				<option value="6">Bình Ðịnh</option>
				<option value="7">Bạc Liêu</option>
				<option value="8">Bắc Giang</option>
				<option value="9">Bắc Kạn</option>
				<option value="10">Bắc Ninh</option>
				<option value="11">Bến Tre</option>
				<option value="12">Cao Bằng</option>
				<option value="13">Cà Mau</option>
				<option value="14">Cần Thơ</option>
				<option value="15">Đà Nẵng</option>
				<option value="16">Đắc Lắc</option>
				<option value="17">Đắk Nông</option>
				<option value="18">Điện Biên</option>
				<option value="19">Đồng Nai</option>
				<option value="20">Đồng Tháp</option>
				<option value="21">Gia Lai</option>
				<option value="22">Hà Giang</option>
				<option value="23">Hà Nam</option>
				<option value="25">Hà Tây</option>
				<option value="26">Hà Tĩnh</option>
				<option value="60">Trà Vinh</option>
				<option value="61">Tuyên Quang</option>
				<option value="62">Vĩnh Long</option>
				<option value="63">Vĩnh Phúc</option>
				<option value="64">Yên Bái</option>
			</select>
			<?php
			if (is_numeric($user->hometown)){
			?>
			<script type="text/javascript">
				$('#hometown').val(<?php echo $user->hometown;?>);
			</script>
			<?php
			}
			?>
		</fieldset>
		<fieldset>
			<label>Số điện thoại</label>
			<input type="text" name="phone" value="<?php echo $user->phone;?>" style="width:40%;">
		</fieldset>
		<?php if($type == 1) { ?>
		<fieldset>
			<label>Thời gian thực tập</label>
			<table class="freetime_table">
				<tr class="freetime_table_head">
					<td colspan="2">Mon</td>
					<td colspan="2">Tue</td>
					<td colspan="2">Wed</td>
					<td colspan="2">Thu</td>
					<td colspan="2">Fri</td>
				</tr>
				<tr>
					<td>AM</td>
					<td>PM</td>
					<td>AM</td>
					<td>PM</td>
					<td>AM</td>
					<td>PM</td>
					<td>AM</td>
					<td>PM</td>
					<td>AM</td>
					<td>PM</td>
				</tr>
				<tr>
					<?php
					for ($i=0;$i<10;$i++){
					?>
					<td><input type="checkbox" name="freetime[]" value="<?php echo $i;?>" <?php echo $freetime[$i];?> checked></td>
					<?php
					}
					?>
				</tr>
			</table>
		</fieldset>
		<?php } ?>
	</div>
	<footer>
		<div class="submit_link">
			<input type="submit" name="submit" value="Lưu" class="alt_btn"/>
			<input type="reset" value="Xóa"/>
		</div>
	</footer>
</article>
</form>
</html>
<script>
$(function() {
        $( "#dob" ).datepicker({
            dateFormat : 'dd/mm/yy',
            changeMonth : true,
            changeYear : true,
            yearRange: '-100y:c+nn',
            maxDate: '-1d'
        });
    });
</script>